from pydantic_settings import BaseSettings, SettingsConfigDict
from typing import List
import os
from pathlib import Path

class Settings(BaseSettings):
    # API 配置
    API_V1_STR: str = "/api"
    PROJECT_NAME: str = "Movie Recommendation System"
    
    # CORS 配置
    BACKEND_CORS_ORIGINS: List[str] = ["*"]
    
    # 数据库配置（未来可能会用到）
    DATABASE_URL: str = os.getenv("DATABASE_URL", "")
    
    # Redis 配置（未来可能会用到）
    REDIS_HOST: str = os.getenv("REDIS_HOST", "localhost")
    REDIS_PORT: int = int(os.getenv("REDIS_PORT", 6379))
    
    # 文件路径配置
    BASE_DIR: Path = Path(__file__).resolve().parent.parent.parent
    STATIC_DIR: Path = BASE_DIR / "static"
    IMAGES_DIR: Path = STATIC_DIR / "images"
    
    # 缓存配置
    CACHE_EXPIRE_TIME: int = 3600  # 1小时
    
    model_config = SettingsConfigDict(
        case_sensitive=True,
        env_file=".env"
    )

settings = Settings() 